import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { ObjCreate } from "../common/ObjCreate";
import { TilePanel } from "../equipment/TilePanel";
import { MagicWeaponRewardCellRender } from "./MagicWeaponRewardCellRender";
import { Global } from "../../../../com/gengine/global/Global";
import { SoundManager } from "../../../common/sound/SoundManager";
import { SoundTypeConst } from "../../../common/sound/SoundTypeConst";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
//class MagicWeaponRankingReward
    
    export  class MagicWeaponRankingReward extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this.setSize(326, 368);
            titleHeight = 27;
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._bg = ObjCreate.createBg(16, 38, 294, 319, this);
            this._tilePanel = new TilePanel();
            this._tilePanel.columnWidth = 250;
            this._tilePanel.rowHeight = 80;
            this._tilePanel.setSize(300, 600);
            this._tilePanel.setStyle("cellRenderer", MagicWeaponRewardCellRender);
            this._tilePanel.move(10, 40);
            addChild(this._tilePanel);
            return;
        }

        public /* override */ hide(): void
        {
            Global.stage.focus = Global.stage;
            SoundManager.instance.soundPlay(SoundTypeConst.UIclose);
            super.hide();
            return;
        }

        public updateRewardList(arg1: Array<any>): void
        {
            if (!arg1) 
            {
                return;
            }
            var loc1=new DataProvider(arg1);
            var loc2=arg1.length;
            this._tilePanel.dataProvider = loc1;
            this._bg.height = (loc2 * 80 - 1);
            this.height = loc2 * 80 + 48;
            return;
        }

        /* internal */ /* var */_tilePanel: TilePanel;

        /* internal */ /* var */_bg: ScaleBitmap;
    }
